﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShExcelLib.Class
{
    public class FormatCodes
    {
        public static Dictionary<int, string> Default => new Dictionary<int, string> {
            {0 , "General"},
            {1 , "0"},
            {2 , "0.00"},
            {3 , "#,##0"},
            {4 , "#,##0.00"},
            {5 , "$#,##0;\\-$#,##0"},
            {6 , "$#,##0;[Red]\\-$#,##0"},
            {7 , "$#,##0.00;\\-$#,##0.00"},
            {8 , "$#,##0.00;[Red]\\-$#,##0.00"},
            {9 , "0%"},
            {10 , "0.00%"},
            {11 , "0.00E+00"},
            {12 , "# ?/?"},
            {13 , "# ??/??"},
            {14 , "mm-dd-yy"},
            {15 , "d-mmm-yy"},
            {16 , "d-mmm"},
            {17 , "mmm-yy"},
            {18 , "h:mm AM/PM"},
            {19 , "h:mm:ss AM/PM"},
            {20 , "h:mm"},
            {21 , "h:mm:ss"},
            {22 , "m/d/yy h:mm"},
            {37 , "#,##0 ;(#,##0)"},
            {38 , "#,##0 ;[Red](#,##0)"},
            {39 , "#,##0.00;(#,##0.00)"},
            {40 , "#,##0.00;[Red](#,##0.00)"},
            {44 , "_(\"$\"* #,##0.00_);_(\"$\"* \\(#,##0.00\\);_(\"$\"* \"-\"??_);_(@_)"},
            {45 , "mm:ss"},
            {46 , "[h]:mm:ss"},
            {47 , "mmss.0"},
            {48 , "##0.0E+0"},
            {49 , "@"},
            {27 , "[$-404]e/m/d"},
            {30 , "m/d/yy"},
            {36 , "[$-404]e/m/d"},
            {50 , "[$-404]e/m/d"},
            {57 , "[$-404]e/m/d"},
            {59 , "t0"},
            {60 , "t0.00"},
            {61 , "t#,##0"},
            {62 , "t#,##0.00"},
            {67 , "t0%"},
            {68 , "t0.00%"},
            {69 , "t# ?/?"},
            {70 , "t# ??/??"}
        };

        /// <summary>
        /// 从默认格式中判断是否是日期格式
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool IsDateFormat(int id)
        {
            int[] idList = new[] { 14, 15, 16, 17, 18, 19, 20, 21, 22, 45, 46, 47, 27, 30, 36, 50, 57 };
            return idList.Contains(id);
        }
    }
}
